package com.foreknow.demo4;

import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个整数：");

        int posNum = 0; // 统计正数的个数
        int negNum = 0; // 统计负数的个数
        while (true){
            int num = sc.nextInt();
            if (num > 0){
                posNum++;
            }else if (num < 0){
                negNum++;
            }else
                break;
        }
        System.out.println("正数的个数为："+ posNum);
        System.out.println("负数的个数为："+ negNum);

    }
}
